<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <select>
        <option>红色</option>
        <option>蓝色</option>
    </select>
    <div class="content">
        当选中select上的标签 将content中的内容设置为指定的颜色
    </div>
    <script>
        // 当选中select上的标签 将content中的内容设置为指定的颜色
        document.querySelector("select").onchange = function () {
            if (this.value == "红色") {
                document.querySelector(".content").style.color = "red"
            }else if(this.value == "蓝色"){
                document.querySelector(".content").style.color = "blue"
            }
            console.log(this.value)
        }
    </script>
</body>

</html>